package chixing.day09.homework.work7;

public class LoginSystem {
    public static boolean validate(User user) {
        if (user == null)
            return false;
        //先判断user是那个类的，是哪个类就调用哪个类的login
        //是否是AdminUser类
        if (user.getClass() == AdminUser.class) {
            return ((AdminUser) user).login(user.getUserName(), user.getUserPassword());
        } else {
            return ((NormalUser) user).login(user.getUserName(), user.getUserPassword());
        }
    }


}
